<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" id="designa" href="./css/common.css" type="text/css" media="all">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            list-style: none;
        }

        .div1 {
            width: 100%;
            height: 80px;
            text-align: center;
            line-height: 80px;
            background-color: #00a06e;
            display: inline-block;
        }

        .name {
            color: #fff;
            font-size: 40px;
        }

        .a1 {
            text-decoration: none;
            font-size: 20px;
            background-color: #fff;
            color: #00a06e;
        }

        
        .tabs ul{
            display: flex;
            background-color: #ddd;
        }
        .tabs  ul li{
            flex: 1;
            text-align: center;
        }
        .tabs li .inner{
            height: 50px;
            line-height: 50px;
            display: inline-block;
        }
        .tabs li.on .inner{
            border-bottom: 3px solid #00a06e;
        }
        .row40{
            height: 40px;
            line-height: 40px; font-size: 16px;
        }
        .img50{
            width: 50px;
            height: auto;
        }
        .img25{
            width: 25px;
            height: auto;
        }

    </style>
</head>

<body style="background-color:#eee; ">

    <div style="width: 100vw; height: 100vh;" class="font_16 color-666 border-red flexBox-c">
        <div class="div1 font_18 color-fff">
            天选之子 男 21岁
            <a class="a1" href="#">切换检测人</a>
        </div>
        <div class="tabs">
            <ul id="tabsUl">
                <li class="on">
                    <span class="pd-l10 pd-r10 inner">舌面图</span>
                </li>
                <li>
                    <span class="pd-l10 pd-r10 inner">舌下图</span>
                </li>
                <li><span class="pd-l10 pd-r10 inner">面部图</span></li>
            </ul>
        </div>
        <ul id="mainUl" class="flex1 over-auto mg-t10" style="padding-bottom: 50px;">
            <li>
                <div>
                    <div class="pd10">
                        <p style="margin-bottom: 10px;border-left: 1px solid #00a06e;" class="row25 pd-l5">中医体质健康状态</p>
                    </div>
                    <div style="border: 1px solid #ddd;" class="mg-auto text-c">
                        <img style="width: 80%; height: auto;" src="./舌下拍照.png">
                    </div>
                </div>
                <div class="row25 text-c mg-t10 mg-b10">如何拍照</div>
                <div style="height: 100px;" class="border-red flexBox-r just-a">
                    <div class="h100 vCenter flex1">
                        <img src="./查看示例.png" class="img50" />
                        <p class="mg-t5">查看示例</p>
                    </div>
                    <div class="h100 vCenter">
                        <img src="./箭头.png" class="img25" />
                    </div>
                    <div class="h100 vCenter flex1">
                        <img src="./伸出舌面.png"class="img50" />
                        <p class="mg-t5">伸出舌头</p>
                    </div>
                    <div class="h100 vCenter">
                        <img src="./箭头.png" class="img25" />
                    </div>
                    <div class="h100 vCenter flex1">
                        <img src="./拍照.png" class="img50" />
                        <p class="mg-t10">拍照</p>
                    </div>
                </div>
        
                <div class="mg-t15 borderT pd10">
                    <h3 class="mg-t10">拍摄注意事项:</h3>
                    <br>
                    <span>光线：白天充足、柔和的自然光线下效果最佳，避免背光、偏暗、曝光。</span>
                    <br>
                    <span>禁忌：不要在食用有色饮食或药物后、有色光源下、早晨起床时、饭后半小时内拍摄舌象。。</span>
                    <br>
                    <span>问题：无法调用相机时，请点击按钮</span>
                </div>
            </li>
            <li class="pd10" style="display: none;">
                <h3>舌下图页面</h3>
            </li>
            <li class="pd10" style="display: none;">
                <h3>面部图页面</h3>
            </li>
        </ul>

    </div>
</body>

<script>
    // 知识点：HTML DOM Element 对象 https://www.w3school.com.cn/jsref/dom_obj_all.asp

    // 选项卡：切换逻辑
    let tabsBox = document.getElementById('tabsUl');
    let allSon = tabsBox.childNodes;

    // 内容页面
    let pagesBox = document.getElementById('mainUl');
    let allpage = pagesBox.childNodes;
    // 提取所有li子节点
    let allLi = []
    for(let i=0;i<allSon.length;i++){
        if(allSon[i].nodeName == 'LI'){
            allLi.push(allSon[i])
        }
    }
    let pageLi = []
    for(let i=0;i<allpage.length;i++){
        if(allpage[i].nodeName == 'LI'){
            pageLi.push(allpage[i])
        }
    }
    // 循环分别为所有的li绑定点击事件
    for(let i=0;i<allLi.length;i++){
        allLi[i].onclick=function(){
            console.log("点击",i)
            clickFun(i)
        }
    }
    function clickFun(i){
        for(let j=0;j<allLi.length;j++){
            if(j !== i){
                allLi[j].className=''
                pageLi[j].style.display='none'
            }else{
                allLi[j].className='on'
                pageLi[j].style.display='block'
            }
        }
    }
    
</script>

</html>